package me.aip.mov.config;

import me.aip.mov.Interceptor.AuthenticationInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebAppConfigurer implements WebMvcConfigurer {
    /**
     * 说明：此处注入 解决在handlerinterceptor实现类中引用无法注入
     */
    @Autowired
    private AuthenticationInterceptor authenticationInterceptor;


    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // 可添加多个，拦截规则：除了login，其他都拦截判断
        registry.addInterceptor(authenticationInterceptor)
                .excludePathPatterns("/auth/login");
    }

}
